var async = require("async");
var renderEngin = require("../common/renderEngin");
var Tools = require("../common/tools");
exports.bill_flow = function(req, res) {
    use(["public/javascripts/bill_flow/init.js", "public/javascripts/service/bill_flowService.js"], function(PageComponent, bill_flowService) {
        var storage = {};
        storage["slider"] = Tools.getPageSliderData("user_center");
        storage["billNo"] = req.query.id;
        storage["trade"] = req.query.module || '';

        if(req.query.module == 'trade'){
          bill_flowService.getBillStatus({
              headers: req.headers,
              seatParams: {
                billNo: req.query.id,
                interType:req.query.submodule
              }
          }, function (result) {
              storage['billStatus'] = result.data;
              PageComponent = React.createFactory(PageComponent);
              renderEngin.call(res, 'bill_flow', PageComponent, storage);
          })
        }else{
          bill_flowService.getBillStatus({
              headers: req.headers,
              seatParams: {billNo: req.query.id}
          }, function (result) {
              storage['billStatus'] = result.data;
              PageComponent = React.createFactory(PageComponent);
              renderEngin.call(res, 'bill_flow', PageComponent, storage);
          })
        }
    });
}
